package goleetcode

import (
	"sort"
)

func buyChoco(price []int, money int) int {
	sort.Ints(price)
	sum := 0
	for i := 0; i < 2; i++ {
		sum += price[i]
	}
	if sum > money {
		return money
	}
	return money - sum
}
